:root {
    --primary-color: #66FCF1;
    --primary-dark: #45A29E;
    --dark-bg: #0B0C10;
    --darker-bg: #1F2833;
    --input-bg: #2A2A2A;
    --text-light: #FFFFFF;
    --text-muted: #CCCCCC;
}

/* ============ BASE STYLES ============ */
body {
    margin: 0;
    background: var(--dark-bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-light);
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============ ANIMATED BACKGROUND ============ */
#code-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--darker-bg) 100%);
    z-index: -10;
    overflow: hidden;
}

.code-char {
    position: absolute;
    font-family: monospace;
    white-space: nowrap;
    opacity: 0.8;
    animation: fall linear infinite;
    pointer-events: none;
    color: var(--primary-color);
    will-change: transform;
}

@keyframes fall {
    0% { transform: translateY(-100vh) translateX(-50%); opacity: 0.8; }
    100% { transform: translateY(100vh) translateX(-50%); opacity: 0.2; }
}

/* ============ NAVIGATION ============ */
.navbar {
    background-color: var(--darker-bg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    padding: 15px 0 !important;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    padding: 10px 0;
    background-color: rgba(31, 40, 51, 0.95);
    backdrop-filter: blur(10px);
}

.navbar-brand {
    color: var(--primary-color) !important;
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: 1px;
    transition: color 0.3s ease, transform 0.3s ease;
    text-decoration: none !important;
}

.navbar-brand:hover {
    color: #ffffff !important;
    transform: scale(1.05);
}

.nav-link {
    color: var(--text-light) !important;
    font-weight: 500;
    padding: 10px 15px !important;
    margin: 0 5px;
    border-radius: 20px;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.nav-link:hover {
    color: var(--dark-bg) !important;
    background-color: #ffffff !important;
}

.navbar-toggler {
    border: none;
    padding: 0;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler-icon {
    width: 30px;
    height: 20px;
    position: relative;
    transition: all 0.3s ease;
}

.navbar-toggler-icon span {
    display: block;
    position: absolute;
    height: 2px;
    width: 100%;
    background: var(--primary-color);
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: all 0.3s ease;
}

.navbar-toggler-icon span:nth-child(1) { top: 0; }
.navbar-toggler-icon span:nth-child(2),
.navbar-toggler-icon span:nth-child(3) { top: 10px; }
.navbar-toggler-icon span:nth-child(4) { top: 20px; }

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon span:nth-child(1),
.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon span:nth-child(4) {
    opacity: 0;
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon span:nth-child(2) {
    transform: rotate(45deg);
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon span:nth-child(3) {
    transform: rotate(-45deg);
}

/* ============ TEXT STYLES ============ */
h1, h2, h3, h4, h5, h6, p, li {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ============ COURSE CONTENT ============ */
.course-details {
    background: rgba(42, 42, 42, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    z-index: 1;
    color: var(--text-light);
}

.course-details h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.course-details p {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.course-details h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
    position: relative;
}

.course-details h2::after {
    content: '';
    position: absolute;
    width: 50px;
    height: 3px;
    background: var(--primary-color);
    bottom: -10px;
    left: 0;
}

.course-details ul {
    list-style: none;
    padding: 0;
}

.course-details ul li {
    font-size: 0.95rem;
    color: var(--text-light);
    padding: 0.5rem 0;
}

/* ============ COURSE CARD (Sticky Buy Section) ============ */
.sticky-buy {
    z-index: 1;
    margin-bottom: 1.5rem;
}

.course-card {
    background: rgba(42, 42, 42, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: visible;
    position: relative;
    z-index: 1;
}

.course-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    display: block;
}

.course-content {
    padding: 1.5rem;
    color: var(--text-light);
    overflow: visible;
}

.course-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.instructor {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.rating {
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.old-price {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: 0.5rem;
}

/* ============ RELATED COURSES ============ */
.related-courses-row {
    margin-top: 2rem;
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    justify-content: space-between;
}

.related-courses-row > * {
    flex: 0 0 calc(33.333% - 0.666rem); /* Three equal columns with gap adjustment */
    max-width: calc(33.333% - 0.666rem);
}

.related-course-card {
    background: rgba(42, 42, 42, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: visible;
}

.related-course-card .course-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.related-course-card .course-content {
    padding: 1rem;
    color: var(--text-light);
}

.related-course-card .course-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.related-course-card .instructor {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.related-course-card .rating {
    font-size: 0.8rem;
    color: var(--primary-color);
}

.related-course-card .price {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* ============ BUTTONS ============ */
.enroll-btn {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: block;
}

.enroll-btn:hover {
    background: var(--primary-color);
    color: var(--dark-bg);
}

#add-to-cart, #buy-now {
    background: var(--udemy-purple);
    color: var(--text-light);
}

#add-to-cart:hover, #buy-now:hover {
    background: var(--primary-dark);
}

#buy-now {
    margin-top: 0.5rem;
}

/* ============ ACCORDION ============ */
.accordion {
    width: 80%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.accordion-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--primary-dark);
    border-radius: 5px;
    margin-bottom: 1rem;
}

.accordion-button {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-button:not(.collapsed) {
    background: var(--primary-dark);
    color: var(--text-light);
}

.accordion-button::after {
    filter: brightness(0) invert(1);
}

.accordion-body {
    background: rgba(42, 42, 42, 0.9);
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 1rem;
}

/* ============ RESPONSIVE ADJUSTMENTS ============ */
@media (max-width: 992px) {
    .accordion {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .course-details {
        margin-top: 1rem;
        padding: 1rem;
    }
    .course-card, .related-course-card {
        min-height: 400px;
    }
    .course-content {
        padding: 1rem;
        min-height: 250px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .course-image {
        height: 350px;
    }
    .related-course-card .course-image {
        height: 200px;
    }
    .enroll-btn {
        font-size: 0.85rem;
        padding: 0.5rem;
    }
    .col-lg-4 {
        display: none;
    }
    .related-courses-row {
        flex-wrap: wrap; /* Allow wrapping on smaller screens */
        justify-content: center;
    }
    .related-courses-row > * {
        flex: 0 0 calc(33.333% - 0.666rem); /* Maintain three items if possible */
        max-width: calc(33.333% - 0.666rem);
    }
}

@media (max-width: 576px) {
    .course-details h1 {
        font-size: 1.5rem;
    }
    .course-details h2 {
        font-size: 1.5rem;
    }
    .course-card, .related-course-card {
        min-height: 350px;
    }
    .course-content {
        min-height: 220px;
        padding: 0.75rem;
    }
    .course-title {
        font-size: 1rem;
    }
    .course-image {
        height: 120px;
    }
    .related-course-card .course-image {
        height: 120px;
    }
    body {
        background: linear-gradient(to bottom, var(--darker-bg), var(--dark-bg));
    }
    .related-courses-row {
        flex-wrap: wrap;
        justify-content: center;
    }
    .related-courses-row > * {
        flex: 0 0 100%; /* Stack vertically on very small screens */
        max-width: 100%;
    }
}

@media (min-width: 769px) {
    .col-lg-4 {
        display: block;
    }
    .sticky-buy {
        position: sticky;
        top: 20px;
        margin-bottom: 0;
    }
    .col-lg-8 .sticky-buy {
        display: none;
    }
}

/* ============ FOOTER ============ */

.custom-footer {
  background: linear-gradient(135deg, #1E1B3A, #2C2A52);
  color: #F8F8F8;
  padding: 2rem 1.5rem;
  font-family: 'Segoe UI', sans-serif;
  backdrop-filter: blur(4px);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  padding-bottom: 1.5rem; /* Removed border-bottom */
}

.footer-box {
  flex: 1;
  min-width: 220px;
  padding-left: 1rem;
}

.footer-box h2 {
  font-size: 1.8rem;
  font-weight: 800; /* Bold CODE-PULSE */
  color: #66FCF1;
  font-family: 'Courier New', monospace;
  margin-bottom: 0.5rem;
}

.footer-box h3 {
  font-size: 1.1rem;
  color: #FFA6F1;
  margin-bottom: 0.7rem;
}

.footer-box p,
.footer-box a {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #EEE;
  text-decoration: none;
  transition: all 0.3s ease;
}

.footer-box a:hover {
  color: #66FCF1;
  padding-left: 5px;
}

.footer-box i {
  margin-right: 6px;
}

.footer-credits {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 1.2rem;
  color: #BBBBBB;
}

.footer-credits a {
  color: #66FCF1;
  text-decoration: underline;
}